﻿using DDDDemoABP1.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore;

namespace DDDDemoABP1.Payments;

public class EfCoreAccountRepository : EfCoreRepository<DDDDemoABP1DbContext, Account>, IAccountRepository
{
    public EfCoreAccountRepository(IDbContextProvider<DDDDemoABP1DbContext> dbContextProvider) : base(dbContextProvider)
    {
    }

    public async Task AddAsync(Account account)
    {
        await base.InsertAsync(account);
    }

    public async Task DeleteAsync(Guid id)
    {
        await base.DeleteAsync(r => r.Id == id);
    }

    public async Task<Account> FindAsync(Guid id)
    {
        return await base.FindAsync(r => r.Id == id);
    }

    public async Task<Account> FindAsync(string accountNo)
    {
        return await base.FindAsync(r => r.AccountNo == accountNo);
    }

    public async Task UpdateAsync(Account account)
    {
        await base.UpdateAsync(account);
    }
}